<template>
    <div class="index-container">
        <v-breadcrumb :breadcrumbData="[{name: '我的'}, {name: '修改密码'}]"></v-breadcrumb>

        <div class="g-box" style="min-height:584px">
            <div class="table">
                <table class="width100 vd-table">
                    <tbody>
                    <tr>
                        <td style="width:160px">原密码</td>
                        <td>
                            <el-input placeholder="请输入" type="password" class="width-400"
                                      v-model="addobj.password"></el-input>
                        </td>
                    </tr>
                    <tr>
                        <td>新密码</td>
                        <td>
                            <el-input placeholder="请输入" type="password" class="width-400"
                                      v-model="addobj.new_password"></el-input>
                        </td>
                    </tr>
                    <tr>
                        <td>确认密码</td>
                        <td>
                            <el-input placeholder="请输入" type="password" class="width-400"
                                      v-model="addobj.r_password"></el-input>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            <el-button v-preventDbClick @click="submit" type="primary" class="width-200">提交
                            </el-button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>

    </div>
</template>

<script type="text/ecmascript-6">
import request from '../../common/js/request.js';
import {tool} from "../../common/js/tool.js";
import config from '../../common/js/config.js'

export default {
    data() {
        return {
            addobj: {
                password: '',
                new_password: '',
                r_password: ''
            }
        };
    },

    computed: {},

    mounted() {
    },

    created() {
    },

    methods: {
        submit() {
            if (this.addobj.new_password != this.addobj.r_password) {
                return tool.message('新密码和确认密码不一致', 'error');
            }
            request({
                url: '/manage/manage/editPassword',
                data: this.addobj
            }).then((res) => {
                tool.message('修改成功，需要重新登录', 'success', () => {
                    this.$router.push({path: "/login"});
                })
            })
        },

    },

};
</script>

<style lang="less" rel="stylesheet/less" scoped>
@import url("../../common/css/variable.less");
</style>
